package store;

import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.*;

//GenericWritable
public class MultipleWritable extends GenericWritable {
	private static final byte NOT_SET = -1;
	private byte type = NOT_SET;
	// private Writable instance;

	private static Class<Writable>[] CLASSES = null;

	static {
		CLASSES = (Class<Writable>[]) new Class[] { Text.class,
				IntWritable.class };
	}

	public MultipleWritable() {
	}

	public MultipleWritable(Writable instance) {
		set(instance);
	}

	@Override
	protected Class<Writable>[] getTypes() {
		return CLASSES;
	}

	@Override
	public String toString() {
		if (this.get() instanceof IntWritable)
			return ((IntWritable) this.get()).toString();
		else
			return ((Text) this.get()).toString();

	}
}
